<template>
  <div>资讯</div>
</template>
<script>
export default {
  // 单个拦截
  beforeRouteEnter(to, from, next) {
    if (to.fullPath !== localStorage.getItem("token")) {
      console.log("验证token");
      //检查是否有token，如果没有，重定向到login
      next("/login");
    } else {
      next();
    }
  },
};
</script>
